//
//  UserModel.m
//  HuaRun2
//
//  Created by admin on 17/9/4.
//  Copyright © 2017年 Sunny. All rights reserved.
//

#import "UserModel.h"
#import "YYModel.h"

@implementation UserModel

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [self yy_modelEncodeWithCoder:aCoder];
}
- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    return [self yy_modelInitWithCoder:aDecoder];
}

- (NSString *)description {
    return [self yy_modelDescription];
}

+ (void)saveUserModel:(UserModel *)userModel {
    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:userModel];
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    [user setObject:data forKey:@"UserModel"];
}

+ (UserModel *)getCurrentUserModel {
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSData *data1 = [user objectForKey:@"UserModel"];
    UserModel *temp1 = [NSKeyedUnarchiver unarchiveObjectWithData:data1];
//    NSLog(@"%@", temp1);

    return temp1;
}

@end
